﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Smart.Data
{
    /// <summary>
    /// oralce  数据源
    /// </summary>
    public class OracleDataSource : DataSource
    {
        public OracleDataSource() : this("orcl") { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="service">oracle 服务名称</param>
        public OracleDataSource(string service)
        {
            Port = "1521";
            Model = service;
            Provider = "System.Data.OracleClient";
            FormatString = "Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = {0})(PORT = {1})))(CONNECT_DATA = (SERVICE_NAME = {2})));User Id={3};Password={4}";
        }

        /// <summary>
        /// 链接字符串
        /// </summary>
        /// <returns></returns>
        public override string ToConnectionString()
        {
            return string.Format(FormatString, Server, Port, Model, UserName, Password);
        }
    }
}
